<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../../include/admincontent.jsp" %>
<div id="Content">
    <div class="btnbar">
        <button type="button" class="save" id="qy_result">录入签约结果</button>
        <button type="button" class="card" id="gxpublishresult" fid="${fid}" deptcode="${deptcode}">公布/屏蔽结果</button>
        <button type="button" class="list" id="resume_next">进入下一步</button>
        <%--<button type="button" class="del" id="repetition_clear">重复简历筛选</button>--%>
       <%-- <button type="button" class="del" id="resume_show">流程查询</button>--%>
        <button type="button" class="save" id="resume_output">导出</button>
        <button type="button" class="save" id="resume_input">导入</button>
        <button type="button" class="list" id="do_tjgw" pid="${pid}" fid="${fid}" deptcode="${deptcode}">推荐其他岗位</button>
        <%--<button type="button" class="back" onclick="javascript:history.go(-1);">返回</button>--%>
    </div>

    <div id="resultpanel" class="condition_cont">
        <form id="qyresultfrom" method="post" action="/Do/GXSigning/RAction?fid=${fid}&deptcode=${deptcode}">
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="55">签约结果:</td>
                    <td width="100">
                        <div>
                            <select name="qystate">
                                <option value="已签约">已签约</option>
                                <option value="无需签约">无需签约</option>
                                <option value="放弃签约">放弃签约</option>
                                <option value="违约">违约</option>
                            </select>
                        </div>
                    </td>
                    <td width="30">备注:</td>
                    <td width="300">
                        <div><input type="text" name="qyremark"/></div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="4">
                        <button type="button"  id="sub_qyresult" class="op">保存签约结果</button>
                    </td>
                </tr>
                </thead>
            </table>
            <div id="rusers"></div>
        </form>
    </div>

    <div id="searchbox">
        <form id="sform">
            <input type="hidden" name="proid" value="${pid}"/>
            <input type="hidden" name="path" value="${fid}"/>
            <input type="hidden" name="rcount" id="checkrount" value=""/>
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="70">应聘岗位:</td>
                    <td >
                        <div>
                           <%-- <input type="text" name="jname"/>--%>

                            <select name="jname">
                                <option value="">请选择</option>
                            <c:forEach var="projectinfojobs" items="${jobs}" varStatus="item" >
                                <c:choose>
                                    <c:when test="${projectinfojobs!=null}">
                                        <option value="${projectinfojobs.jobname}">${projectinfojobs.jobname}</option>
                                    </c:when>

                                </c:choose>
                            </c:forEach>
                            </select>
                        </div>
                    </td>
                    <td width="60">姓名:</td>
                    <td>
                        <div><input type="text" name="name"/></div>
                    </td>
                    <td width="60">身份证号:</td>
                    <td>
                        <div><input type="text" name="cardno"/></div>
                    </td>

                    <td width="60">所学专业:</td>
                    <td >
                        <div>
                            <input type="text" name="majorname"/>
                        </div>
                    </td>
                    <td width="60">毕业院校:</td>
                    <td >
                        <div>
                            <input type="text" name="university"/>
                        </div>
                    </td>


                </tr>
                <tr>
                    <td >毕业时间:</td>
                    <td>
                        <div><input type="text" name="graduationtime"/></div>
                    </td>
                    <td>联系电话:</td>
                    <td>
                        <div>
                            <input type="text" name="tel"/>
                        </div>
                    </td>
                    <td>最高学历:</td>
                    <td >
                        <div><select name="education">
                            <option value="-1">不限</option>
                            ${education}</select></div>
                    </td>
                    <td>签约状态:</td>
                    <td >
                        <div> <select name="qystate">
                            <option value="">不限</option>
                            <option value="未处理">未处理</option>
                            <option value="已签约">已签约</option>
                            <option value="无需签约">无需签约</option>
                            <option value="放弃签约">放弃签约</option>
                            <option value="违约">违约</option>
                        </select></div>
                    </td>
                    <td>意向地点:</td>
                    <td >
                        <div>
                            <input type="text" name="presentsalaryamount"/>
                        </div>
                    </td>
                </tr>
                <tr class="moretj">
                    <td width="60">民族:</td>
                    <td width="150">
                        <div><select name="mzcode">
                            <option value="">不限</option>
                            ${minzu}</select></div>
                    </td>
                    <td width="60">政治面貌:</td>
                    <td width="150">
                        <div><select name="zzmmcode">
                            <option value="">不限</option>
                            ${zzmm}</select></div>
                    </td>
                    <td width="60" style="text-align:right;">年龄:</td>
                    <td width="160">
                        <div><input type="text" name="agefrom" style="max-width: 40%"/>至<input type="text" name="ageto" style="max-width: 40%"/></div>
                    </td>
                   <%-- <td width="16" style="text-align:center;">至</td>
                    <td width="60">
                        <div><input type="text" name="ageto"/></div>
                    </td>--%>
                    <td width="60" style="text-align:right;">身高:</td>
                    <td width="160">
                        <div><input type="text" name="heightfrom" style="max-width: 40%"/>至<input type="text" name="heightto" style="max-width: 40%"/></div>
                    </td>
                  <%--  <td width="36" style="text-align:center;">至</td>
                    <td width="50">
                        <div></div>
                    </td>--%>
                    <td width="60">性别:</td>
                    <td>
                        <div>
                            <select name="sexname">
                                <option value="">不限</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr class="moretj">
                    <td>户口所在地:</td>
                    <td>
                        <div><input type="text" name="hukouaddress"/></div>
                    </td>
                    <td>现居住地:</td>
                    <td>
                        <div><input type="text" name="nowaddress"/></div>
                    </td>
                    <td>是否放弃:</td>
                    <td>
                        <div>
                            <select name="fqstate">
                                <option value="">全部</option>
                                <option value="未放弃" selected>未放弃</option>
                                <option value="已放弃">已放弃</option>
                            </select>
                        </div>
                    </td>
                    <td colspan="4"></td>
                </tr>

                <tr>
                    <td colspan="9">
                       <div style="padding-top: 8px;"> <button id="searchbtn" type="button" class="search"></button>
                           <button id="clearbtn" type="reset" class="del" title="清除" style="flex: 1;margin-left: 5px;"></button>
                       </div>
                    </td>
                    <td>
                        <button id="showhidebtn" type="button" class="moretjbtn0" onclick="moreparam()"
                                title="高级查询"></button>
                    </td>
                </tr>
                </thead>
            </table>
        </form>
    </div>

    <div id="page_top" class="page"></div>
    <table class="treeTable" id="tablelist">
        <thead>
        <tr>
            <td width="20"><input type="checkbox" class="allcheckbox" title="选择全部/取消全选"/></td>
            <td width="30">序号</td>
            <%-- <td width="60">简历编号</td>--%>
            <td width="100">姓名</td>
            <td width="120">身份证号</td>
            <td width="30">性别</td>
            <td width="120">毕业院校</td>
            <td width="120">所学专业</td>
            <td width="70">学历</td>
            <td width="70">岗位</td>
            <!-- <td width="60">生源地</td> -->
            <td width="30">年龄</td>
            <td width="80">毕业时间</td>
            <td width="55">政治面貌</td>
            <td width="75">联系电话</td>
            <td width="50">签约状态</td>
            <td width="80">备注</td>
            <td width="80">最近登录</td>
            <td width="80">个人情况</td>
            <td width="50">公布结果</td>
            <td width="50"></td>
        </tr>
        </thead>
        <tbody id="result"></tbody>
    </table>
    <div id="page_bottom" class="page"></div>
</div>
<script src="../../../resources/js/plugins/layui/layui.all.js" type="text/javascript"></script>
<script type="text/javascript">
    var pageobj = null;
    $(document).ready(function () {
        getList();
        $('#searchbtn').click(function () {
            getList();
        });

        //签约结果
        $('#qy_result').click(function () {
            $('#resultpanel').slideToggle(300);
            $(this).toggleClass('cur').blur().siblings().removeClass('cur');

        });

        $("#qyresultfrom").Validform({
            ajaxPost: true,
            callback: function (data) {
                if (data.state) {
                    getList();
                    $('#rusers').empty();
                }
                $.Showmsg(data.Message);
            }
        });

        $('#sub_qyresult').click(function () {
            $('#rusers').empty();
            var checkIds=$('.allcheckbox').data('checkIds');
            if (!!checkIds&&checkIds.length>0){
                $(checkIds).each(function (i,n) {
                    $('#rusers').append('<input type="hidden" name="uid" value="' + n.substring(3,n.length) + '"/>');
                });
                $("#qyresultfrom").submit();
                return false;
            }else{
                $.Showmsg("至少选择一条数据！");
            }


        });

        $('#resume_ok').click(function () {
            var url = '/Do/GXSigning/ResumeOkAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}';
            cgMoreData1(url);
        });
        $('#resume_no').click(function () {
            var id = '';
            var count = 0;
            $('#tablelist tbody input[type=checkbox]').each(function () {
                if ($(this).is(":checked")) {
                    count++;
                    id = $(this).attr('id').replace('cb_', '');
                }
            });
            if (count < 1) {
                //$.Showmsg('请选择一条信息');
                parent.layer.alert('请选择一条信息!', {icon: 2});
            } else if (count > 1) {
                //$.Showmsg('只能选择一条信息');
                parent.layer.alert('只能选择一条信息!', {icon: 2});
            } else {
                openpLayer('简历筛选未通过', '/Do/GXSigning/bz?id=' + id + '&pid=${pid}&fid=${fid}&deptcode=${deptcode}', '500px', '200px');
            }
        });

        $('#resume_next').click(function () {
            parent.layer.confirm('只有通过已签约或无需签约的人员才能执行此操作。<br>确定要执行吗？', {
                btn: ['是', '否']
            }, function () {
               // cgMoreData('/Do/GXResume/NextAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}');
                toNextFlow('/Do/GXSigning/NextAction?pid=${pid}&fid=${fid}&deptcode=${deptcode}','${fid}');
                parent.layer.closeAll();
            }, function () {
                parent.layer.closeAll();
            });
        });
        $('#resume_output').click(function () {
            //openLayer('请选择要导出的字段', '/ExcelDown/DownDoResume?pid=${pid}&fid=${fid}&deptcode=${deptcode}', '60%', '70%');
            openpLayer('请选择要导出的字段', '/ExcelDown/DownDoResume?pid=${pid}&fid=${fid}&deptcode=${deptcode}&'+$('#sform').serialize(), '60%', '70%');

        });

        $('#resume_input').click(function () {
            openpLayer('Excel数据导入', '/ExcelImport/ImportExcelPage?pid=${pid}&fid=${fid}&deptcode=${deptcode}&'+$('#sform').serialize(), '60%', '500px');
        });
        
        $('#repetition_clear').click(function () {
            $('#checkrount').val(1);
            getList();
            //$('#checkrount').val('');
        });
        $('#clearbtn').click(function () {
            $('#checkrount').val('');
            $('#sform')[0].reset();
            getList();
        });
    });

    $('#resumeCheck_ok').click(function(){
        var checkRows=$('.allcheckbox').data('checkIds');
        if(!!!checkRows||checkRows.length==0){
            parent.layer.alert('至少选择一条信息', {icon: 2});
        }else{
            var ids="";
            $(checkRows).each(function (index,itme) {
                ids+=itme.replace('cb_', '')+",";
            });
            $.post("/Do/GXSigning/ResumeAllOkAction",{pid:"${pid}",fid:"${fid}",deptcode:"${deptcode}",ids:ids},function (result) {
                if (result.state) {
                    parent.layer.alert(result.Message, {icon: 1});
                    getList();
                }
                else {
                    parent.layer.alert(result.Message, {icon: 2});
                }
            },"JSON");

        }
    });

    $('#resumeCheck_no').click(function(){

        var checkRows=$('.allcheckbox').data('checkIds');
        if(!!!checkRows||checkRows.length==0){
            parent.layer.alert('至少选择一条信息', {icon: 2});
        }else{
            var ids="";
            $(checkRows).each(function (index,itme) {
                ids+=itme.replace('cb_', '')+",";
            });
            parent.layer.prompt({title: '请填写未通过原因，并确认', formType: 2}, function(text, index){
                parent.layer.close(index);
                $.post("/Do/GXSigning/ResumeAllNoAction"
                    ,{pid:"${pid}",fid:"${fid}",deptcode:"${deptcode}",ids:ids,sxbz:text}
                    ,function (result) {
                        if (result.state) {
                            parent.layer.alert(result.Message, {icon: 1});
                            getList();
                        }
                        else {
                            parent.layer.alert(result.Message, {icon: 2});
                        }
                    }
                    ,"json");
            });

        }
    });

    function getList() {
        pageobj = $('.page').myPagination({
            cssStyle: "pagination",
            saveChecked:true,
            rowNumber: true,
            showTitle:true,
            contextMenu:true,
            contextMenuParam:{
                menu: [{
                    text: "情况说明",
                    callback: function(ele) {
                        console.log($(this))
                        var tcid=$(ele).find('input[type=checkbox]:eq(0)').attr('id');
                        var rmarkid=$(ele).find('input[type=hidden]:eq(0)').val();
                        var cardno=ele[0].cells[3].innerText;
                        var rname=ele[0].cells[2].innerText;
                        parent.layer.prompt({title: '请填写姓名:'+rname+' 身份证:'+cardno+' 个人情况说明，并确认', formType: 2}, function(text, index){
                            parent.layer.close(index);
                            var cid=tcid.replace('cb_','');
                            $.post("/SaveUserRemark"
                                ,{id:rmarkid,pid:"${pid}",fid:"${fid}",deptcode:"${deptcode}",rid:cid,content:text,rname:rname,cardno:cardno}
                                ,function (result) {
                                    if (result.state) {
                                        $.Showmsg(result.message);
                                        getList();
                                    }
                                    else {
                                        $.Showmsg(result.message);
                                    }
                                }
                                ,"json");
                        });
                    }
                },

                    {
                        text: "查看个人简历",
                        callback: function(ele) {
                            var url=$(ele).find('a').attr('href');
                            if(!!url){
                                window.open(url);
                            }
                        }
                    },
                    {
                        text: "刷新列表",
                        callback: function() {
                            getList()
                        }
                    }
                ]
            },
            ajax: {
                on: true,
                url: '${path}/DUserResume/getusers?flowid=${fid}',
                param: $('#sform').serialize(),
                dataType: 'html',
                callback: function (data) {
                 //var rows= createRowNo(data);
                    $('#result').html(data);
                    parent.changeFrameHeight();
                    $('#result a').click(function () {
                        event.stopPropagation();
                    });
                }
            }
        });


    }

    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }



    function reloadData() {
        pageobj.onReload();
    }

    $(function () {
        fillSelectState("qystate","${fid}");
    })
</script>
</body>
</html>